package Gui;
// from http://www.java-forums.org/awt-swing/6574-add-image-jframe.html
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class ImagePanel extends JPanel {
	private Image m_image;

	public ImagePanel(Image image){
		m_image= image;
		Dimension size = new Dimension(image.getWidth(null), image.getHeight(null));
		setPreferredSize(size);
		setMinimumSize(size);
		setMaximumSize(size);
		setSize(size);
		setLayout(null);
	}
	public ImagePanel(String path) throws IOException{
		//	this(ImageIO.read(new File(path)));
		this(new ImageIcon(path).getImage());
	
	}

	public void paintComponent(Graphics g) {
		g.drawImage(m_image, 0, 0, null);
	}
}
